angular.module('ZJPC')
 .service('ModalService',['$uibModal', '$state', '$stateParams', ModalService]);


function ModalService($uibModal, $state, $stateParams) {

	//监控页面
	this.openModal = function (id){

	    var url = $state.href('modal', {id:id});	
	    window.open(url, '_blank');
	    
	}

	this.openModalFunc = function (checkedView, url, controller){
		var modalInstance = $uibModal.open({
		    templateUrl : url,
		    controller : controller,
		    size: 'bayonet-size',
		    resolve : {
		        data : function() {
		            return checkedView;
		        }
		    }
		})
	} 

	this.openModalTp = function (checkedView,tp,ctrl){
		var modalInstance = $uibModal.open({
		    templateUrl : tp,//script标签中定义的id
		    controller : ctrl,//modal对应的Controller
		    resolve : {
		        data : function() {//data作为modal的controller传入的参数
		            return checkedView;//用于传递数据
		        }
		    },
		    size: 'lg'
		})
	}

	this.openModalBySize = function (url, controller, checkedView,size){
		var modalInstance = $uibModal.open({
		    templateUrl : url,
		    controller : controller,
		    size:size,
		    resolve : {
		        data : function() {//data作为modal的controller传入的参数
		            return checkedView;//用于传递数据
		        }
		    }
		})
	} 

}
